//
//  WXEventModule.m
//  HellowWeex
//
//  Created by 金宝泉 on 17/3/20.
//  Copyright © 2017年 x298017064010. All rights reserved.
//

#import "WXEventModule.h"

@implementation WXEventModule

@synthesize weexInstance;

#pragma mark - 只有通过宏注册后的方法, weex才能够调用
WX_EXPORT_METHOD(@selector(openURL:callback:))

- (void)openURL:(NSString *)url {
    
    NSString *newURL = url;
    if ([url hasPrefix:@"//"]) {
        newURL = [NSString stringWithFormat:@"http:%@", url];
    } else if (![url hasPrefix:@"http"]) {
        newURL = [NSURL URLWithString:url relativeToURL:self.weexInstance.scriptURL].absoluteString;
    }
}

- (void)openURL:(id)msg callback:(WXModuleCallback)callback
{
    
    callback(@{@"result":@"success"});
}

@end
